package cn.vc.basicmodule.rabbitmqconfig;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ArticleRabbitMqConfig {
    @Bean
    public DirectExchange articleDirectExchange() {
        return new DirectExchange("article.direct", true, false);
    }
    /**
     * <h2>文章审核申请</h2>
     * @return
     */
    @Bean
    public Queue articleApplyQueue() {
        return QueueBuilder.durable("article.queue.apply").build();
    }
    @Bean
    public Binding articleApplyBinding() {
        return BindingBuilder.bind(articleApplyQueue()).to(articleDirectExchange()).with("apply");
    }
    /**
     * <h2>文章审核通过</h2>
     */
    @Bean
    public Queue articlePublishQueue() {
        return QueueBuilder.durable("article.queue.publish").build();
    }
    @Bean
    public Binding articlePublishBinding() {
        return BindingBuilder.bind(articlePublishQueue()).to(articleDirectExchange()).with("publish");
    }
}
